package com.visualexpress.datacreation;

import com.visualexpress.dao.SiteDAO;
import com.visualexpress.dao.UserDAO;
import com.visualexpress.domain.Site;
import com.visualexpress.domain.User;
import com.visualexpress.shards.ShardConfigurationUtil;

public class CreateUsers {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		for(int i=0;i<1000;i++)
		{
			User u =new User();
			u.setUsername("tester"+i);
			u.setPassword("tester"+i);
			u.setEmail("luohouqi2@gmail.com");
			u.setType(User.TYPE_NORMAL);
			u.setState(User.State_UNAPPROVED);
			
			String siteName = ShardConfigurationUtil.getLocalShardConfiguration().getShardSessionFactoryName();
			Site s = new SiteDAO().findByName(siteName);
			u.setSite(s);
			
			new UserDAO().save(u);
			System.out.println("Crerted user " +u.getId());
		}

	}

}
